﻿<?php
	include_once './inc/isLogin.php';
?>
<style>
.multipage span {
    display: inline-block;
    float: none;
}
.multipage {
    text-align: center;
}
.multipage a:hover span {
    background: none repeat scroll 0 0 #004199;
    color: #FFFFFF;
    text-decoration: none;
}
.multipage span {
    background-color: #FFFFFF;
    border: 1px solid #CCCCCC;
    cursor: pointer;
    height: 20px;
    line-height: 20px;
    list-style: none outside none;
    margin-right: 1px;
    padding-left: 8px;
    padding-right: 8px;
}
div{
	vertical-align: middle;
}
.show_post {
	padding:30px;padding-top:0;
}
.show_post p {
	border-bottom: 1px dashed #EB6100;
    padding: 10px;
}
.show_post p select {
	border-color: #7F9DB9;
	border-style: solid;
	border-width: 1px;
	padding: 2px;
}
.left_post {
	width:100px;
	display:block;
	float:left;
	text-align:right;
	padding-right:20px;
}
.required {
	color: #FF0000;
	display: inline-block;
	font-size: 17px;
	padding-right:5px;
	vertical-align: middle;
}
.text1 {
	border: 1px solid #7F9DB9;
	height: 17px;
	margin-right: 4px;
	padding: 3px 2px 0;
	vertical-align: middle;
	width: 330px;
}
.text2{
	width: 170px !important;
}

.fabu1 {
    background: url("../images/psearch.gif") no-repeat scroll 0 -100px transparent;
    border: medium none;
    color: #FFFFFF;
    cursor: pointer;
    font: 700 14px/34px "宋体",sans-serif;
    height: 34px;
    margin-right: 3px;
    overflow: hidden;
    text-align: center;
    width: 107px;
	margin-left:120px;
}
.fabu1:hover{
	padding-left:5px;
}
.list_r{

	float:right;
}
.list_l_one{
	margin-right:15px;
}
.list_r_one{
	margin-right:15px;
}
#MyAnjuke .tab {
    background: none repeat scroll 0 0 #F4F8FA;
    clear: both;
    height: 25px;
    padding-left: 9px;
}
#MyAnjuke .tab h1 dl {
    height: 25px;
}
#MyAnjuke .tab h1 dl dt {
    background: url("http://pages.anjukestatic.com/img/myanjuke/cs10/myanjukeicons.png") no-repeat scroll 0 0 transparent;
    float: left;
    height: 25px;
}
#MyAnjuke .tab h1 dl dt.tL {
    background-color: white;
    background-position: 0 -479px;
    width: 8px;
}
#MyAnjuke .tab h1 dl dt.t0 {
    background-color: white;
    background-image: none;
    border-top: 1px solid #D8EFF7;
    color: #333333;
    font: bold 14px/28px '宋体';
    height: 24px;
    padding: 0 7px;
}
#MyAnjuke .tab h1 dl dt.tR {
    background-color: white;
    background-position: -92px -479px;
    width: 12px;
}
#MyAnjuke .tab h1 dl dt.refresh {
    background-color: white;
    background-position: 0 -598px;
    border-top: 1px solid #D8EFF7;
    line-height: 26px;
    padding-right: 3px;
    text-indent: 22px;
}
#MyAnjuke .show {
    margin: 15px 15px 0;
    padding-bottom: 35px;
    width: 705px;
}
#MyAnjuke .tab ul li {
    float: left;
    height: 25px;
    line-height: 25px;
    margin-right: 9px;
    text-align: center;
    width: 100px;
}
#MyAnjuke .tab ul li a {
    background: url("http://pages.anjukestatic.com/img/myanjuke/cs10/myanjukeicons.png") no-repeat scroll left -562px transparent;
    color: #333333;
    display: block;
    font-family: SimSun;
    font-size: 14px;
    height: 25px;
    line-height: 25px;
    width: 100px;
}
#MyAnjuke .tab ul li a:hover {
    background: url("http://pages.anjukestatic.com/img/myanjuke/cs10/myanjukeicons.png") no-repeat scroll left -526px #FFFFFF;
    text-decoration: none;
}
#MyAnjuke .tab ul li a.on {
    background: url("http://pages.anjukestatic.com/img/myanjuke/cs10/myanjukeicons.png") no-repeat scroll left -478px #FFFFFF;
    font-weight: bold;
}
.multipage{
	text-align:center;
	padding-bottom:5px;
}
</style>
<?php
		if(true){
		//page_1
			if ($_GET['page']) {
				$page = $_GET['page'];
				if(is_numeric($page)){
				}else{
					$page = 1;
				}
			} else {
				$page = 1;
			}
			$per_page = 20;//每页显示20条
			if($page<=1){$page=1;}//最大值还没有设置,在后面的db结果设置
			$start_from = ($page-1)*$per_page;
		}


?>
<?php
/*
 * Created on 2011-11-9
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
            $current_url = $_SERVER['PHP_SELF'];
            $userid = $_SESSION['user_id'];
         	require_once("../includes/configure.php");
			require_once("../includes/database.php");
            require_once("../includes/func.php");
			$db = Database::Connect();
		      if(true){
			//page_2
				$count_sql = "select count(*) from xiaoqu A
					left join configuration B
					on A.quyu = B.this_id
					left join configuration C
					on A.quyu2 = C.this_id ";
					//where B.`key` = 'zufang_quyu'
					//and C.`key` = 'zufang_shangquan' ";//=1

				$count_result = $db->GetResultSet($count_sql);
				while ($count_row = mysql_fetch_array($count_result)) {
					$total_item = $count_row[0];
				}
				$max_page = ceil($total_item/$per_page);
			}
			$sql = "select A.*,B.`value` as quyu1_str,C.`value` as quyu2_str from xiaoqu A
					left join configuration B
					on A.quyu = B.this_id
					left join configuration C
					on A.quyu2 = C.this_id ";
					//where B.`key` = 'zufang_quyu'
					//and C.`key` = 'zufang_shangquan' ";//默认0为出租
			$sql.=" order by isSystem desc,A.quyu,A.quyu2,A.is_hot desc limit $start_from,$per_page";
		    $zufangrows = $db->GetResultSet($sql);


?>
<div class="right_container">
  <div id="MyAnjuke">
    <div class="tab">
      <h1 style="padding:0;margin:0;">
        <dl style="padding:0;margin:0;">
          <dt class="tL"></dt>
          <dt class="t0">所有小区信息</dt>
          <dt class="tR"></dt>
        </dl>
      </h1>
	  <a href="xiaoqu_update.php?action=add" style="float:right;margin-right: 8px;margin-top: -21px;">添加小区信息</a>
    </div>
    <div class="show_post">

		<p class="green info">
			<?php echo $del_result;?>
		</p>


		<?php
			$num =0;
			while($row=mysql_fetch_array($zufangrows)){
		$num++;

			?>
			  <p>
				<span class="list_l_one"><?php if($row['isSystem'])echo '[系统] ';?><?php echo $num;?></span>
				<span class="list_l">
					<?php echo $row['quyu1_str']?> - 
				</span>
				<span class="list_l">
					<?php echo $row['quyu2_str']?>
				</span>
				&nbsp;&nbsp;
				<span class="list_l">
					小区: <a target="_blank" href="../xiaoqu_detail.php?id=<?php echo $row['this_id']?>"><?php echo $row['xiaoquming']?></a>
				</span>
				&nbsp;&nbsp;
				地址:&nbsp;<span class="list_l" style="!margin-top:-30px;"><?php echo $row['dizhi']?></span>
				<span class="list_r" style="!margin-top:-30px;"><?php echo $row['fabushijian']?></span>
				<span class="list_r list_r_one" style="!margin-top:-30px;">
					<a href="xiaoqu_update.php?id=<?php echo $row['this_id']?>">编辑</a></span>
			  </p>
				<?php //<span class="list_r list_r_one"><a href="geren.php?main=qiuzu_post&update=<?php echo $row['this_id']? >">编辑</a></span>?>
		<?php
			}
			
		?>
    </div>


  </div>
</div>

<?php if(true){
	//page_3
?>
<div class="multipage">

	<?php
		if($page!=1){
			echo '<a class="prv" href="'.deleteRepeatVar($current_url,'page').'&page='.($page-1).'"><span>上一页</span></a>';
		}
		if($max_page>10){
			$ind = $page-5;
		}
		if($ind<=0){
			$ind=1;
		}
		$page_show_total = 10;//最多显示10页
		for(;$ind<=$max_page;$ind++){
			if($ind==$page){
				echo '<strong><span>'.$ind.'</span></strong>';
			}else{
				echo '<a href="'.deleteRepeatVar($current_url,'page').'&page='.$ind.'"><span>'.$ind.'</span></a>';
			}
			$page_show_total--;
			if($page_show_total==0){
				break;
			}
		}
		if($page!=$max_page && $max_page!=0){
			echo '<a class="next" href="'.deleteRepeatVar($current_url,'page').'&page='.($page+1).'"><span>下一页</span></a>';
		}
		
	?>
</div>
<?php 
	}
	$db->Close();
?>